from framework.vo.RespResult import RespResult
from framework.constant.RespCode import RespCode


class RespUtil(object):

    @staticmethod
    def ok(data=None) -> RespResult:
        return RespResult(RespCode.OK, {} if data is None else data)

    @staticmethod
    def inner_error(msg='') -> RespResult:
        return RespResult(RespCode.INNER_ERROR, msg)

    @staticmethod
    def please_try_later() -> RespResult:
        return RespResult(RespCode.PLEASE_TRY_LATER, {})

    @staticmethod
    def cannot_find_microdev_type_code() -> RespResult:
        return RespResult(RespCode.CANNOT_FIND_MICRODEV_TYPE_CODE, {})

    @staticmethod
    def microdev_not_in_work_order() -> RespResult:
        return RespResult(RespCode.MICRODEV_NOT_IN_WORK_ORDER, {})

    @staticmethod
    def microdev_unauthorize_offline() -> RespResult:
        return RespResult(RespCode.MICRODEV_UNAUTHORIZE_OFFLINE, {})

    @staticmethod
    def devsite_not_bind_microdev() -> RespResult:
        return RespResult(RespCode.DEVSITE_NOT_BIND_MICRODEV, {})

    @staticmethod
    def post_repeat() -> RespResult:
        return RespResult(RespCode.POST_REPEAT, {})

    @staticmethod
    def request_method_invalid() -> RespResult:
        return RespResult(RespCode.REQUEST_METHOD_INVALID, {})

    @staticmethod
    def param_lack(msg='') -> RespResult:
        return RespResult(RespCode.PARAM_LACK, msg)

    @staticmethod
    def unauthorized() -> RespResult:
        return RespResult(RespCode.UNAUTHORIZED, {})

    @staticmethod
    def not_found_user() -> RespResult:
        return RespResult(RespCode.NOT_FOUND_USER, {})

    @staticmethod
    def invalid_param(msg='') -> RespResult:
        return RespResult(RespCode.INVALID_PARAM, msg)

    @staticmethod
    def data_error(msg='') -> RespResult:
        return RespResult(RespCode.DATA_ERROR, msg)

    @staticmethod
    def not_support(msg='') -> RespResult:
        return RespResult(RespCode.NOT_SUPPORT, msg)

    @staticmethod
    def not_found_data(msg='') -> RespResult:
        return RespResult(RespCode.NOT_FOUND_DATA, msg)

    @staticmethod
    def invalid_operation(msg='') -> RespResult:
        return RespResult(RespCode.INVALID_OPERATION, msg)

